package test;

public class FibonacciSequence {
    public static void main(String[] args) {
        int n = 20;
        int prev = 0;
        int curr = 1;
        System.out.println("斐波那契数列前" + n + "项的值：");
        for (int i = 0; i < n; i++) {
            int next = prev + curr;
            System.out.print(next + " ");
            prev = curr;
            curr = next;
        }
    }
}